import request from '@/utils/request'

// 获取区域列表
export function getAreaList(pageIndex, pageSize, name) {
  return request({
    method: 'get',
    url: '/api/vm-service/region/search',
    params: {
      pageIndex,
      pageSize,
      name
    },
    contentType: 'application/x-www-form-urlencoded; charset=utf-8'
  })
}

// 新增区域
export function addArea(data) {
  return request({
    method: 'post',
    url: '/api/vm-service/region',
    data
  })
}

// 获取区域详情
export function getAreaDetail(pageIndex, pageSize, regionId) {
  return request({
    method: 'get',
    url: `/api/vm-service/node/search`,
    params: {
      pageIndex,
      pageSize,
      regionId
    }
  })
}

// 修改区域回显
export const EditArea = id => request.get(`/api/vm-service/region/${id}`)

// 修改区域确定
export function editConfirm(data, id) {
  return request({
    method: 'put',
    url: `/api/vm-service/region/${id}`,
    data
  })
}

// 删除区域
export const DeleteArea = id => request.delete(`/api/vm-service/region/${id}`)

// 点位管理的第二个页面点位管理 渲染页面

export function getNodeDetail(pageIndex, pageSize) {
  return request({
    method: 'get',
    url: `/api/vm-service/node/search`,
    params: {
      pageIndex,
      pageSize
    }
  })
}

// 点击 查看详情 获取点位详情

export function LookDetail(id) {
  return request({
    method: 'get',
    url: `/api/vm-service/node/vmList/${id}`
  })
}
// 新增下拉框数据获取

// 获取商圈列表

export function getbusinessType() {
  return request({
    method: 'get',
    url: '/api/vm-service/businessType'
  })
}
// 获取合作商
export function getPartner(pageIndex, pageSize) {
  return request({
    method: 'get',
    url: '/api/user-service/partner/search',
    params: {
      pageIndex,
      pageSize
    }
  })
}

// 点位管理新建
export function addNode(data) {
  return request({
    method: 'post',
    url: '/api/vm-service/node',
    data
  })
}

// 修改点位
export function modifyNode(id, data) {
  return request({
    method: 'put',
    url: `/api/vm-service/node/${id}`,
    data
  })
}
// 删除点位
export function delNode(id) {
  return request({
    method: 'delete',
    url: `/api/vm-service/node/${id}`
  })
}
